﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Common.Utilities.DLR;

namespace Rules.DataCleaning.TableFieldValidationRules
{
    [Serializable]
    [OrmClass("FieldValidationRule","RuleID",true)]
    public class FieldValidationRule
    {
        #region members
        private int _RuleID;
        /// <summary></summary>
        public int RuleID
        {
            get
            {
                return this._RuleID;
            }
            set
            {
                this._RuleID = value;
            }
        }

        private string _RuleName;
        /// <summary></summary>
        public string RuleName
        {
            get
            {
                return this._RuleName;
            }
            set
            {
                this._RuleName = value;
            }
        }

        private string _CodeBlock;
        /// <summary></summary>
        [OrmField("CodeBlock",SqlDbType.Text, 2000, OrmFieldSerializationMethod.DefaultSerialization)]
        public string CodeBlock
        {
            get
            {
                return this._CodeBlock;
            }
            set
            {
                this._CodeBlock = value;
            }
        }

        private string _Description;
        /// <summary></summary>
        [OrmField("Description",SqlDbType.VarChar, 2000, OrmFieldSerializationMethod.DefaultSerialization)]
        public string Description
        {
            get
            {
                return this._Description;
            }
            set
            {
                this._Description = value;
            }
        }

        private string _CreatedBy;
        /// <summary></summary>
        public string CreatedBy
        {
            get
            {
                return this._CreatedBy;
            }
            set
            {
                this._CreatedBy = value;
            }
        }

        private string _UpdatedBy;
        /// <summary></summary>
        public string UpdatedBy
        {
            get
            {
                return this._UpdatedBy;
            }
            set
            {
                this._UpdatedBy = value;
            }
        }

        private DateTime _CreatedOn;
        /// <summary></summary>
        public DateTime CreatedOn
        {
            get
            {
                return this._CreatedOn;
            }
            set
            {
                this._CreatedOn = value;
            }
        }

        private DateTime _UpdatedOn;
        /// <summary></summary>
        public DateTime UpdatedOn
        {
            get
            {
                return this._UpdatedOn;
            }
            set
            {
                this._UpdatedOn = value;
            }
        }
        #endregion

        #region ctor
        public FieldValidationRule()
        {
            this._RuleID = -1;
            this._RuleName = "New field validation rule";
            this._CodeBlock = string.Empty;
            this._Description = string.Empty;
            this._CreatedBy = Environment.UserName;
            this._UpdatedBy = Environment.UserName;
            this._CreatedOn = DateTime.Now;
            this._UpdatedOn = DateTime.Now;
        }

        public FieldValidationRule(int ruleID, string ruleName, string codeBlock,
            string desc, string createdBy, string updatedBy, 
            DateTime createdOn, DateTime updatedOn)
        {
            this._RuleID = ruleID;
            this._RuleName = ruleName;
            this._CodeBlock = codeBlock;
            this._Description = desc;
            this._CreatedBy = createdBy;
            this._UpdatedBy = updatedBy;
            this._CreatedOn = createdOn;
            this._UpdatedOn = updatedOn;
        }
        #endregion
    }
}
